package com.code.shiro.user.controller;


import com.alibaba.fastjson.JSON;
import com.code.shiro.user.service.UserService;
import com.code.wanmi.entity.wm_user.WmSysRole;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**缺省功能
 * 1.删除角色
 * 修改用户信息*/
@Api(tags = "角色管理")
@RestController
@RequestMapping("/role")
@CrossOrigin
public class WmSysRoleController {
    @Autowired
    private UserService userService;

    /**
     * 显示角色列表
     * @return
     */


    @ApiOperation(value="显示角色列表")
    //返回说明
    @ApiResponses({
            @ApiResponse(code=200 , message="执行成功，固定返回打招呼内容，字符串表现形式；")
    })

    @RequestMapping(value = "/displayrole",method = RequestMethod.GET)
    public String displayrole(){
        String wmSysRole= userService.dispalyWmSysRole();
        return wmSysRole;
    }


    /**
     * 根据传入的用户的角色ID删除角色
     * @return
     */

    @ApiOperation(value="根据用户角色ID删除角色")
    //参数说明
    @ApiImplicitParams({

            @ApiImplicitParam(name="roleId" ,value="角色ID" ,required=true ,dataType="Long",paramType="query")})
    //返回说明
    @ApiResponses({
            @ApiResponse(code=200 , message="执行成功")
    })

    @RequestMapping(value = "/deleteRole",method = RequestMethod.PATCH)
    public String deleteRoleById(Long roleId){
        return userService.deleteRoleById(roleId);
    }
}
